home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-07-29 | 2.2 KB | 70 lines | [TEXT/MPS ] |
- # NewSave - replacement "Save" script supporting file backup and remember
-
- Set NFile "{#}" # get number of command line arguments
- If ({NFile} == 0)
- # no command line arguments - act on active window
- Set LeafName "`ParseFileName -l "{Active}"`" # get the file's leafname
- Save "{Active}" ∑∑ Dev:Null
- If ({Status} == 0)
- # the Save was successful
- Set RemFiles "`Begin; Files -f "{Backup}{LeafName}".[0-9]+; End ≥ Dev:Null`"
- If ("{RemFiles}" != "")
- # Remember Files exist
- Set Exit 0
- Confirm "Delete the old Remember files?"
- If ({Status} == 0)
- # Delete all the old "Remember" backup files
- For i in "{RemFiles}"
- Delete {i}
- End # For i
- End # If {Status}
- End # If RemFiles
- End # If {Status}
- Else
- Loop
- Break If ({NFile} <= 0) # exit if all arguments have been processed
- If ("{1}" == "-a")
- # Save all Windows option
- For i in "`Windows -q`"
- Set LeafName "`ParseFileName -l "{i}"`" # get the file's leafname
- Save "{i}" ∑∑ Dev:Null
- If ({Status} == 0)
- # the Save was successful
- Set RemFiles "`Begin; Files -f "{Backup}{LeafName}".[0-9]+; End ≥ Dev:Null`"
- If ("{RemFiles}" != "")
- Set Exit 0
- Confirm "Delete the old Remember files?"
- If ({Status} == 0)
- # Delete all the old "Remember" backup files
- For j in "{RemFiles}"
- Delete {j}
- End # For j
- End # If {Status}
- End # If RemFiles
- End # If {Status}
- End # For i
- Else
- Set LeafName "`ParseFileName -l "{1}"`" # get the file's leafname
- Save "{1}" ∑∑ Dev:Null
- If ({Status} == 0)
- # the Save was successful
- Set RemFiles "`Begin; Files -f "{Backup}{LeafName}".[0-9]+; End ≥ Dev:Null`"
- If ("{RemFiles}" != "")
- # Remember Files exist
- Set Exit 0
- Confirm "Delete the old Remember files?"
- If ({Status} == 0)
- # Delete all the old "Remember" backup files
- For i in "{RemFiles}"
- Delete {i}
- End # For i
- End # If {Status}
- End # If RemFiles
- End # If {Status}
- Shift
- Evaluate NFile -= 1 # update the argument counter
- End # If {1}
- End # Loop
- End # If {NFile}
-
- # end of NewSave